#ifndef DECRYPTFILE_H_
#define DECRYPTFILE_H_

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "diccionario.h"

#define HEXASTRLEN 32
#define AESKEYLENGTH 16 //16 bytes = 128 bits
#define MAXKEYLENGTH 8
#define MAXNAMELENGTH 20

typedef struct userElem
{
	char name[MAXNAMELENGTH];
	unsigned char key[HEXASTRLEN + 1];
} userElem;


/**
 * Tries to decrypt the input file, using an userElem to get
 * the correct key.
 *
 * @param[in]	user	    The user element.
 * @param[in]	encFile	    The file to be decrypted.
 * @param[out]	respFile	The file where the decrypted answer
 * 							will be saved.
 * @param[in]	dictionary	The dictionary to get the key.
 *
 * @return		1 in case of success, 0 otherwise, -1 in case of error.
 */
int decryptFile(userElem user, FILE * encFile, FILE * respFile, 
	dictioStruct * dictionary);

/**
 * Print on screen array of unsigned char in a Hexadecimal Format
 *
 * @param[in]	bytes       The unsigned char array to be printed.
 * @param[in]	length      Length of array.
 *
 * @return	Void
 */
void printHexa(unsigned char * bytes, int length);

#endif /*DECRYPTFILE_H_*/
